package io.ken.im.common.domain.enums;

/**
 * @author: ken
 * @description: 消息发送状态
 * @date 2023-12-12
 **/
public enum IMSendCode {

    SUCCESS(0, "success"),
    NOT_ONLINE(0, "not oline"),
    NOT_FIND_CHANNEL(0, "not find channel"),
    UNKNOWN_ERROR(0, "unknown error");

    private final Integer code;
    private final String desc;

    IMSendCode(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static IMSendCode fromCode(Integer code) {
        for (IMSendCode sendCode : values()) {
            if (sendCode.code.equals(code)) {
                return sendCode;
            }
        }
        return null;
    }

    public Integer code() {
        return code;
    }
}
